/********************************************************************************
 * Project Name		[JavaSE_Fundamentals]
 * File Name     	[Interface.java]
 * Creation Date 	[2015-01-01]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ********************************************************************************/
package objectOriented;

/**
 * 接口
 * 
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 * 
 */
public class Interface {

	public static void main(String[] args) {
		MotionInterface i = new Animal();
		i.run();

		Car car = new Car();
		car.start();

		@SuppressWarnings("unused")
		Animal animal = (Animal) i;
	}
}

/**
 * 
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 *
 */
interface MotionInterface {

	public abstract void start();

	public abstract void run();

	public abstract void stop();
}

/**
 * 
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 *
 */
class Animal implements MotionInterface {

	@Override
	public void run() {
		System.out.println("animal is running");
	}

	@Override
	public void start() {
		System.out.println("animal prepare to run");
	}

	@Override
	public void stop() {
		System.out.println("animal stoped");
	}
}

/**
 * 
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 *
 */
class Car implements MotionInterface {

	@Override
	public void run() {
		System.out.println("animal is running");
	}

	@Override
	public void start() {
		System.out.println("animal prepare to run");
	}

	@Override
	public void stop() {
		System.out.println("animal stoped");
	}
}